<template>
  <div v-if="apidatas" class="tabs">
    <template v-if="num==0">
      <div v-for="(item,i) of apidatas.recommend_list" :key="i" class="itfor" @click="examin(item.id)">
        <van-image width="400" height="120" lazy-load :src="item.cover" />
        <div class="texttil">
          <p class="p1">{{item.label}}</p>
          <p class="p2">{{item.intro}}</p>
        </div>
      </div>
    </template>
    <template v-if="num==1">
      <div v-for="(itemow,j) of apidatas.hottest_list" :key="j" class="itfor" @click="examin(itemow.id)">
        <van-image width="400" height="120" lazy-load :src="itemow.cover" />
        <div class="texttil">
          <p class="p1">{{itemow.label}}</p>
          <p class="p2">{{itemow.intro}}</p>
        </div>
      </div>
    </template>
    <template v-if="num==2">
      <div v-for="(itemtw,k) of apidatas.latest_list" :key="k" class="itfor" @click="examin(itemtw.id)">
        <van-image width="400" height="120" lazy-load :src="itemtw.cover" />
        <div class="texttil">
          <p class="p1">{{itemtw.label}}</p>
          <p class="p2">{{itemtw.intro}}</p>
        </div>
      </div>
    </template>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState } = createNamespacedHelpers("apiDataModules");
export default {
  name: "tabs",
  props: {
    num: Number
  },
  created() {
    // console.log(this.num);
    // this.apidata();
  },
  computed: {
    ...mapState(["apidatas"])
  },
  methods: {
    examin(id){
      this.$router.push({path:"/examin",query:{id:id}})
    }
  }
};
</script>

<style lang="scss" scoped>
@import "@/style/home/tabs.scss";
</style>